#These Are My PyGameExtensions
import pygame # pygame is the library im using to make the game
from pygame.locals import * # not sure what this is
from textrect import *
import os

def Ezwrite(message, screen, fontsize, textx, texty, textwidth, textheight):
    my_font = pygame.font.Font(None, fontsize)
    my_rect = pygame.Rect((textx, texty, textwidth, textheight))  
    rendered_text = render_textrect(message, my_font, my_rect, (216, 216, 216), (48, 48, 48), 0)
    if rendered_text:
        screen.blit(rendered_text, my_rect.topleft)
    pygame.display.update()
    
def textScreenWidget(message, screen):
    my_font = pygame.font.Font(None, 22)
    my_rect = pygame.Rect((50, 500, 500, 50))  
    rendered_text = render_textrect(message, my_font, my_rect, (216, 216, 216), (48, 48, 48), 0)
    if rendered_text:
        screen.blit(rendered_text, my_rect.topleft)
    pygame.display.update()
    
def loadImage(file):
    try:
        file = pygame.image.load(os.path.join('../data/images', file))
        colorkey = file.get_at((0, 0))
        if colorkey is True:
            image.set_colorkey(colorkey, pygame.RLEACCEL)
    except:
        print 'Unable to load: ' + file
        return
    return file

def clearSurface(surface):
        surface.fill((0,0,0))